package java_DesignPattern.CreatorPattern.FactoryPattern.FactoryMethod;

/**
 * 工厂方法测试类
 */
public class Test {

    public static void main(String[] args) {

//        CoffeStore coffeStore = new CoffeStore(new LatteCoffeFactory());
//        Coffe coffe = coffeStore.orderCoffe("拿铁咖啡");
//        Systems.out.println(coffe.getName());

        CoffeFactory coffeFactory = new AmericaCoffeFactory();
        CoffeStore coffeStore = new CoffeStore();

        //set方法设置咖啡工厂
        coffeStore.setCoffeFactory(coffeFactory);
        Coffe coffe = coffeStore.orderCoffe("美式咖啡");
        System.out.println(coffe.getName());
    }
}
